/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bugsandcritters;

/**
 *
 * @author Robert Gibbons
 */
public class Point {
    public double X,Y;
    
    public void FromFacing(int Facing,double X,double Y)
    {
        switch(Facing)
        {
            case 0:
                this.X = X - GridWorld.CellsWidth;
                this.Y = Y;
                break;
            case 1:
                this.X = X;
                this.Y = Y - GridWorld.CellsHeight;
                break;
            case 2:
                this.X = X + GridWorld.CellsWidth;
                this.Y = Y;
                break;
            case 3:
                this.X = X;
                this.Y = Y + GridWorld.CellsHeight;
                break;
        }
    }
    
    public int InvertFacing(int Facing)
    {
        if(Facing<2)
            return Facing + 2;
        else 
            return Facing - 2;
    }
    
    public int AddFacing(int Facing)
    {
        if(Facing < 3)
            return Facing + 1;
        else 
            return 0;
    }
}
